<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="/static/js/app/pay/jquery.min.js"></script>
    <title>填写支付宝信息</title>
    <script src="/static/js/app/pay/common.js"></script>
    <script src="/static/js/app/pay/util.js"></script>
    <script src="/static/js/app/pay/init.js"></script>
    <!--<script src="../rem.js"></script>-->
    <script src="/static/js/app/pay/rem-1.js"></script>
    <link rel="stylesheet" href="commom.css">
    <style>
        *{margin: 0;padding: 0;}
        .zfb-top>span{width: 0.2rem;
            height: 0.34rem;
            background: url("/static/img/app/pay/return.png") no-repeat;
            background-size: 100% 100%;
            float: left;
            margin-left: 0.3rem;
            margin-top: 0.7rem;}
        .zfb-sum>b{height: 100%;line-height: 1rem;color:#333;font-size: 0.28rem;float: left;font-weight: normal;text-align: center; margin: auto 0.2rem;}
        .zfb-sum>input{ font-size: 0.28rem;color: #333;outline: none;border: 0;float: left;height: 90%;line-height: 0.9rem;width: 5rem; margin-top: 0.03rem;}
        .zfb-sum>span{width: 0.28rem;height: 0.28rem;float: right;color: #fff;background: #eee;font-size: 0.28rem;text-align: center;
            line-height: 0.24rem;border-radius: 50%;margin-top: 0.36rem;margin-right: 0.2rem}
        .zfbforward>p{width: 100%;height: 0.5rem;font-size: 0.24rem;color: #999;line-height: 0.5rem;text-indent: 0.3rem}
        .zfbforward .apply{width:6.9rem;height:0.9rem;color: #fff;background: #999;text-align: center;
            font-size: 0.32rem;line-height: 0.9rem;margin: 0 auto;border-radius: 0.04rem;margin-top: 1.4rem}
        .zfbforward .a-color{background: #f05c5c}
        .hide{display: none}
        .message{position: fixed;height: 0.5rem;top:20%;width: 100%;height: 1rem;text-align: center;}
        .message>span{color: #fff;text-align: center;line-height: 0.5rem;border-radius: 0.04rem;background: rgba(0,0,0,0.4);
            font-size: 0.2rem;display: inline-block;margin: 0 auto;padding:0 0.5rem;}
        /*.dismiss,#complete{ -webkit-tap-highlight-color:transparent;}*/
    </style>
</head>
<body>
<script src="/static/js/common/Monitor.js"></script>
<div class="zfbforward">
    <div class="zfb-top">
        <span class="return"></span>
        <h1>提现账户</h1>
    </div>
    <div class="zfb-sum">
        <b>支付宝姓名</b>
        <input class="zfbinfo" id="zfbname" type="text" placeholder="请输入真实姓名">
        <span class="hide dismiss" >×</span>
    </div>
    <div class="zfb-sum">
        <b>支付宝账号</b>
        <input class="zfbinfo" id="zfbele" type="text" placeholder="请输入支付宝账号">
        <span class="hide dismiss" >×</span>
    </div>
    <p>温馨提示：支付宝账户和姓名要匹配，否则无法到账</p>
    <div class="apply a-color" id="complete">完成</div>
</div>
<div class="message hide" id="message"><span>请输入完整提现信息！</span></div>
<script>
    var capitalAccount = null;
    $(function () {
        initUser();
        refreshCapitalAccount();
        capitalAccount = userobj.capitalAccount ? JSON.parse(userobj.capitalAccount) : null;
        //判断input输入框
        $(".zfbinfo").on("input",function () {
            var name=$(this).val();
            if(name){
                $(this).siblings("span").removeClass("hide");
            }else{
                $(this).siblings("span").addClass("hide");
            }
        });
        $(".dismiss").click(function () {
            $(this).siblings(".zfbinfo").val("");
            $(this).addClass("hide");
        });
        //
        if(capitalAccount && capitalAccount.bankCode==1){
            $("#zfbname").val(capitalAccount.accountName);
            $("#zfbele").val(capitalAccount.accountNo);
        }else{

        }
        //点击提交
        $("#complete").click(function () {
            var zfbname=$("#zfbname").val();
            var zfbNo=$("#zfbele").val();
            if(zfbname==""){
                $("#message>span").html("请输入姓名");
                $("#message").removeClass("hide");
                setTimeout(function () {
                    $("#message").addClass("hide");
                },2000);
            }else if(zfbNo==""){
                $("#message>span").html("请输入账户");
                $("#message").removeClass("hide");
                setTimeout(function () {
                    $("#message").addClass("hide");
                },2000);
            }else{
                var accountName = $("#zfbname").val();
                var accountNo = $("#zfbele").val();
                $.ajax({
                    url:genUrl("/wallet/setCapitalAccount"),
                    type: 'GET',
                    contentType:"application/json",
                    dataType:'json',
                    async:false,
                    headers:{
                        "x-access-id": userobj.accessId,
                        "x-access-token": userobj.accessToken,
                        "x-ua": ua
                    },
                    data:{
                        "customerId":userobj.accessId,
                        "bankCode":1,
                        "accountName":accountName,
                        "accountNo":accountNo
                    },
                    success: function (res) {
                        if(res.code==0){
                            refreshCapitalAccount();
                            window.location.href=base_url+"/putForward/zfbforward.html";
                        }else{
                            $("#message>span").html(res.message,1);
                            $("#message").removeClass("hide");
                            setTimeout(function () {
                                $("#message").addClass("hide");
                            },2000);
                        }
                    }
                });
            }
        });
        // // 信息提醒(姓名)
        // $("#zfbname").blur(function () {
        //     var text=$(this).val();
        //     var reg=/^[\u4e00-\u9fa5]+$/gi;
        //     if(!reg.test(text)){
        //         $("#message>span").html("您输入的姓名可能不正确，请检查");
        //         $("#message").removeClass("hide");
        //         setTimeout(function () {
        //             $("#message").addClass("hide");
        //         },2000);
        //     }
        // })
        // // 信息提醒(账号)
        // $("#zfbele").blur(function () {
        //     var text=$(this).val();
        //     var reg=/^[\u4e00-\u9fa5]+$/gi;
        //     if(reg.test(text)){
        //         $("#message>span").html("您输入的账号可能不正确，请检查");
        //         $("#message").removeClass("hide");
        //         setTimeout(function () {
        //             $("#message").addClass("hide");
        //         },2000);
        //     }
        // })
    })
</script>
</body>
</html>